Calculates the transposition of the matrix M.